﻿using Microsoft.Analytics.Interfaces;
using Microsoft.Analytics.Types.Sql;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace MyProblem
{
    public class AboutInteger
    {
        public bool IsPalindrome(int x)
        {

            int reverseX = Reverse(x);
                if(reverseX == x)
                {
                    return true;
                }
                return false;

           
            
        }
        public int Reverse(int x)
        {
            try
            {
                int reverseX = 0;
                int temp = x;
                while (temp != 0)
                {
                    reverseX = checked(reverseX * 10 + temp % 10);
                    if (reverseX > int.MaxValue)
                    {
                        reverseX = 0;
                        break;
                    }
                    temp = temp / 10;
                }
                return reverseX;


            }
            catch (OverflowException e)
            {

                return 0;
            }
            catch (Exception e)
            {
                return 0;
            }

        }
    }
}